const Router = require('koa-router')

const router = new Router({
  prefix: '/common',
})

// ctx is a object
// next is a function
router.get('/open', async (ctx, next) => {
  ctx.body = {
    msg: 'open api'
  }
})

// integrate with await
router.get('/desc', async (ctx, next) => {
  await ctx.render('desc.pug', {
    pageTitle: 'DESC',
    info: 'this is the description'
  })
})

module.exports = router